home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / euro_mat.cpp < prev    next >
Text File  |  1996-03-20  |  27KB  |  897 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <graph.h>
  4. #include <i86.h>
  5. #include <dos.h>
  6. #include <conio.h>
  7. #include <float.h>
  8. #include <time.h>
  9. #include <math.h>
  10. #include <string.h>
  11.  
  12. #include "defines.h"
  13. #include "data.equ"
  14. #include "3deng.h"
  15. #include "intronet.h"
  16. #include "sos.h"
  17. #include "audio.h"
  18. #include "digi.h"
  19. #include "midi.h"
  20. #include "config.h"
  21. #include "timer.h"
  22. #include "mallocx.h"
  23. #include "unmangle.h"
  24. #include "gamedata.h"
  25.  
  26. #include "eurodefs.h"
  27. #include "euro_fxd.h"
  28. #include "euro.equ"
  29. #include "euro_sym.h"
  30. #include "euro_def.h"
  31. #include "euro_var.h"
  32. #include "euro_mem.h"
  33. #include "euro_spt.h"
  34. #include "euro_gen.h"
  35. #include "euro_grf.h"
  36. #include "euro_cnt.h"
  37. #include "euro_dsk.h"
  38. #include "euro_sqd.h"
  39. #include "euro_sel.h"
  40. #include "euro_fix.h"
  41. #include "euro_usr.h"
  42. #include "euro_inf.h"
  43. #include "euro_gdv.h"
  44. #include "euro_win.h"
  45. #include "euro_net.h"
  46. #include "euro_cmd.h"
  47. #include "euro_rnd.h"
  48. #include "euro_int.h"
  49.  
  50. extern     char    suspend_audio;
  51. extern     int    music_state;
  52. extern      void    init_keyboard();
  53. extern      void     init_users();
  54. extern      void     init_team();
  55. extern      "C"     char old_mf;
  56. extern   "C"    int  x1ok;
  57. extern   "C"    int  y1ok;
  58. extern   "C"    int  x2ok;
  59. extern   "C"    int  y2ok;
  60. extern   "C"    int  bitaccept;
  61. extern      match(int argc, char **argv);
  62.  
  63. struct passback_per{
  64.     short per;
  65.     short inj;
  66.     char dpts;
  67.     };
  68.  
  69. extern passback_per performance[40];
  70.  
  71. //********************************************************************************************************************************
  72.  
  73. void    setup_player_data(int team_no)
  74. {
  75. }                            
  76.  
  77. //********************************************************************************************************************************
  78.  
  79. void    get_cup_venue()
  80. {
  81. }
  82.  
  83. //********************************************************************************************************************************
  84.  
  85. void    PlayMatch(int argc, char **argv)
  86.     {
  87.         char    CommsSetup;
  88.  
  89.         if ( EUROgameType == EURO_network_game || 
  90.              EUROgameType == EURO_wireplay ||
  91.              EUROgameType == EURO_serial_game ||
  92.              EUROgameType == EURO_modem_game )
  93.             CommsSetup    =    Yes;
  94.         else            
  95.             CommsSetup    =    No;
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. // old actua        suspend_audio    =    1;
  104. // old actua           StopSong();
  105. // old actua           music_state    =    NULL;
  106.  
  107.  
  108.         if (EUROverbose)
  109.             printf("\n  DEALLOCATING MEMORY BEFORE RUNNING MATCH.\n\n");
  110.  
  111.         DeAllocateTexturePages();
  112.         DeAllocateDisplayBuffers();
  113.            init_keyboard();
  114.            init_users();
  115.  
  116.            key_togs[0x2f] = match_info.vidi;
  117. // old actua           setup.stadium  = 1;
  118.  
  119.            if (!network_on)
  120.                old_mf    =    TRUE;
  121.            else
  122.                old_mf    =    FALSE;
  123.  
  124.         x1ok        =    NULL;
  125.         x2ok        =    NULL;
  126.         y1ok        =    NULL;
  127.         y1ok        =    NULL;
  128.         bitaccept    =    NULL;
  129.  
  130. // old actua        if (cal0!=NULL)
  131. // old actua        {            
  132. // old actua            x1ok       = 1;    
  133. // old actua            y1ok       = 2;    
  134. // old actua            bitaccept|= (x1ok+y1ok);
  135. // old actua        }
  136. // old actua
  137. // old actua
  138. // old actua        if (cal1!=NULL)
  139. // old actua        {            
  140. // old actua            x2ok       = 4;    
  141. // old actua            y2ok       = 8;    
  142. // old actua            bitaccept|= (x2ok+y2ok);
  143. // old actua        }
  144.  
  145.         setup.stadium    =    match_info.venue;
  146.  
  147.  
  148. // old actua        key1[UP_KEY]    =    InsertKey(batch_info.keys_used[UP_RED]);    //0x1e;           
  149. // old actua        key1[DN_KEY]    =    InsertKey(batch_info.keys_used[DN_RED]);    //0x2c;           
  150. // old actua        key1[LF_KEY]    =    InsertKey(batch_info.keys_used[LF_RED]);    //0x33;           
  151. // old actua        key1[RT_KEY]    =    InsertKey(batch_info.keys_used[RT_RED]);    //0x34;           
  152. // old actua        key1[F1_KEY]    =    InsertKey(batch_info.keys_used[F1_RED]);    //0x10;           
  153. // old actua        key1[F2_KEY]    =    InsertKey(batch_info.keys_used[F2_RED]);    //0x35;          
  154. // old actua
  155. // old actua        key2[UP_KEY]    =    InsertKey(batch_info.keys_used[UP_RED+6]);    //-0x48;    
  156. // old actua        key2[DN_KEY]    =    InsertKey(batch_info.keys_used[DN_RED+6]);    //-0x50;    
  157. // old actua        key2[LF_KEY]    =    InsertKey(batch_info.keys_used[LF_RED+6]);    //-0x4b;    
  158. // old actua        key2[RT_KEY]    =    InsertKey(batch_info.keys_used[RT_RED+6]);    //-0x4d;    
  159. // old actua        key2[F1_KEY]    =    InsertKey(batch_info.keys_used[F1_RED+6]);    //0x52;        
  160. // old actua        key2[F2_KEY]    =    InsertKey(batch_info.keys_used[F2_RED+6]);    //0x53;        
  161. // old actua
  162.  
  163. // to add         match_info.team_a_score        =    0;
  164. // to add         match_info.team_b_score        =    0;
  165. // to add         match_info.team_a_penalties    =    0;
  166. // to add         match_info.team_b_penalties    =    0;
  167. // to add         match_info.penalties        =    0;
  168. // to add         match_info.extra        =    0;
  169.  
  170. // old actua        if (keyboard==0)
  171. // old actua             InitialiseMOUSE();
  172.  
  173.  
  174.         //…ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª 
  175.         //∫                                                              ∫
  176.         //∫ MATCH SETUP MODULE-> PASSING FRONTEND DATA TO ANDY's SECTION ∫
  177.         //∫                                                              ∫
  178.         //»ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº 
  179.  
  180.             EUROmatch_info.GameType    =    EUROgameType;
  181.  
  182.             if ( CommsSetup == Yes )
  183.                 {
  184.                     EUROmatch_info.rand        =    1234;
  185.                     EUROmatch_info.offside        =    Off;
  186.                     EUROmatch_info.wind        =    Off;
  187.                     EUROmatch_info.substitutes    =    Off;
  188.                     EUROmatch_info.bookings        =    Off;
  189.                     EUROmatch_info.freekicks    =    Off;
  190.  
  191.                     match_info.rand        =    1234;
  192.                     match_info.offside    =    Off;
  193.                     match_info.wind        =    Off;
  194.                     match_info.substitutes    =    Off;
  195.                     match_info.bookings    =    Off;
  196.                     match_info.freekicks    =    Off;
  197.  
  198.                        old_mf                =    FALSE;
  199.                 }
  200.  
  201.             else
  202.  
  203.                 {            
  204.                     EUROmatch_info.rand        =    GetRnd2();
  205.                     EUROmatch_info.offside        =    EUROoffside;
  206.                     EUROmatch_info.wind        =    EUROwind;
  207.                     EUROmatch_info.substitutes    =    EUROsubs;
  208.                     EUROmatch_info.bookings        =    EURObookings;
  209.                     EUROmatch_info.freekicks    =    EUROfouls;
  210.  
  211.                     match_info.rand        =    GetRnd2();
  212.                     match_info.offside     =    EUROoffside;
  213.                     match_info.wind        =    EUROwind;
  214.                     match_info.substitutes    =    EUROsubs;
  215.                     match_info.bookings     =    EURObookings;
  216.                     match_info.freekicks    =    EUROfouls;
  217.  
  218.                        old_mf                =    TRUE;
  219.                 }
  220.  
  221.             EUROmatch_info.camera        =    EUROcamera;
  222.             EUROmatch_info.audio        =    EUROaudio;
  223.             EUROmatch_info.crowd        =    EUROcrowd;
  224.             EUROmatch_info.pitch        =    EUROpitch;
  225.             EUROmatch_info.commentary    =    EUROcommentary;
  226.             EUROmatch_info.music        =    EUROmusic;
  227.             EUROmatch_info.master        =    EUROmaster;
  228.             EUROmatch_info.timeit        =    EUROtimeit;
  229.             EUROmatch_info.vidi        =    EUROvidi;
  230.             EUROmatch_info.time        =    EUROtime;
  231.             EUROmatch_info.tga_enable    =    EUROtga;
  232.                         
  233.             match_info.camera        =    EUROcamera;
  234.             match_info.audio        =    EUROaudio;
  235.             match_info.crowd        =    EUROcrowd;
  236.             match_info.pitch        =    EUROpitch;
  237.             match_info.commentary        =    EUROcommentary;
  238.             match_info.music        =    EUROmusic;
  239.             match_info.master        =    EUROmaster;
  240.             match_info.timeit        =    EUROtimeit;
  241.             match_info.vidi            =    EUROvidi;
  242.             match_info.time            =    EUROtime;
  243.             match_info.tga_enable        =    EUROtga;
  244.  
  245.             EUROmatch_info.tac_1        =    0;
  246.             EUROmatch_info.tac_2        =    0;
  247.  
  248.             match_info.tac_1        =    0;
  249.             match_info.tac_2        =    0;
  250.  
  251.             EUROmatch_info.Team_A_goals      =    0;        
  252.             EUROmatch_info.Team_B_goals      =    0;        
  253.             EUROmatch_info.penalties         =    0;
  254.             EUROmatch_info.extra             =    0;
  255.             EUROmatch_info.Team_A_penalties    =    0;
  256.             EUROmatch_info.Team_B_penalties    =    0;
  257.             EUROmatch_info.return_mins    =    0;
  258.             EUROmatch_info.language        =    0;
  259.  
  260.             match_info.team_a_score      =    0;        
  261.             match_info.team_b_score      =    0;        
  262.             match_info.penalties         =    0;
  263.             match_info.extra             =    0;
  264.             match_info.team_a_penalties    =    0;
  265.             match_info.team_b_penalties    =    0;
  266.             match_info.return_mins        =    0;
  267.             match_info.language        =    0;
  268.  
  269.  
  270.             setup.stadium                 =     EUROvenue;
  271.             setup.detail.sky             =    EUROsky;
  272.             setup.detail.lines           =    EUROlineDetail;
  273.             setup.vidi_type              =    EUROvidiType;
  274.             setup.detail.players         =    EUROplyrDetail;
  275.             setup.detail.pitch           =    EUROptchDetail;
  276.             setup.start_res          =    EUROresoln;
  277.             setup.screen_size           =    EUROscrSize;
  278.  
  279.             setup.team_a            =    EUROteamA;
  280.             setup.team_b            =    EUROteamB;
  281.  
  282.             for (char c=0; c<4; c++)
  283.             {EUROmatch_info.CntrlTypes[c] = -1;}
  284.  
  285.             EUROmatch_info.TeamA_users    =    0;
  286.             EUROmatch_info.TeamB_users    =    0;
  287.             char    UserFlag     =     1;
  288.             char    CntrlCnt     =     0;
  289.  
  290.  
  291.         // Euro Championship / Friendly / Practice games
  292.  
  293.             for (char u=0; u<EUROnoOfMatchPlyrs; u++)
  294.             {        
  295.                     if (EUROverbose)
  296.                     printf("    User %d    %s\n", u,
  297.                         GetTEAMname( UserList[u].team, 11) );                    
  298.                 
  299.                 if ( UserList[u].team == setup.team_a )
  300.                 {
  301.                     EUROmatch_info.TeamA_users|=    UserFlag;            
  302.                     EUROmatch_info.CntrlTypes[CntrlCnt] = UserList[u].control;
  303.                     EUROmatch_info.PlyrTypes[CntrlCnt] = UserList[u].player;
  304.                     UserFlag+=    UserFlag;
  305.                     CntrlCnt++;
  306.                 }
  307.  
  308.                 if ( UserList[u].team == setup.team_b )
  309.                 {
  310.                     EUROmatch_info.TeamB_users|=    UserFlag;            
  311.                     EUROmatch_info.CntrlTypes[CntrlCnt] = UserList[u].control;
  312.                     EUROmatch_info.PlyrTypes[CntrlCnt] = UserList[u].player;
  313.                     UserFlag+=    UserFlag;
  314.                     CntrlCnt++;
  315.                 }
  316.             }
  317.  
  318.         //…ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª 
  319.         //∫                                             ∫
  320.         //∫ COPY BOTH TEAMS PLAYER DATA INTO MATCH INFO ∫
  321.         //∫                                             ∫
  322.         //»ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº 
  323.  
  324.         strcpy( &EUROmatch_info.TeamAname[0], GetTEAMname( EUROteamA, 11) );
  325.         strcpy( &EUROmatch_info.TeamBname[0], GetTEAMname( EUROteamB, 11) );
  326.         memcpy( &EUROmatch_info.TeamAsquad[0], &SquadInfo[ (EUROteamA*20) ], 20 );
  327.         memcpy( &EUROmatch_info.TeamBsquad[0], &SquadInfo[ (EUROteamB*20) ], 20 );
  328.  
  329.         if (EUROverbose)
  330.         {
  331.             printf("\n  MATCH INTERFACE DATA:\n\n");
  332.             printf("    Home Team:  %s\n",   &EUROmatch_info.TeamAname[0] );
  333.             printf("    Away Team:  %s\n\n", &EUROmatch_info.TeamBname[0] );
  334.         }
  335.  
  336.         short    PlyrIndex1, PlyrIndex2;        
  337.  
  338.             for (char p=0; p<20; p++)
  339.             {        
  340.  
  341.                 PlyrIndex1 = NormalisePlayer( p, EUROteamA );
  342.                 PlyrIndex2 = NormalisePlayer( p, EUROteamB );
  343.                 
  344.                 EUROmatch_info.TeamA[p].pace           =    Pace[ PlyrIndex1 ];
  345.                 EUROmatch_info.TeamA[p].power           =    Power[ PlyrIndex1 ];
  346.                 EUROmatch_info.TeamA[p].control           =    Control[ PlyrIndex1 ];
  347.                 EUROmatch_info.TeamA[p].flair           =    Flair[ PlyrIndex1 ];
  348.                 EUROmatch_info.TeamA[p].vision           =    Vision[ PlyrIndex1 ];
  349.                 EUROmatch_info.TeamA[p].accuracy       =    Accuracy[ PlyrIndex1 ];
  350.                 EUROmatch_info.TeamA[p].stamina       =    Stamina[ PlyrIndex1 ];
  351.                 EUROmatch_info.TeamA[p].discipline     =    Discipline[ PlyrIndex1 ];
  352.                 EUROmatch_info.TeamA[p].fitness     =    Fitness[ PlyrIndex1 ];
  353.  
  354.                 if (EUROverbose)
  355.                 {
  356.                     printf("plyr %d    (%d)  pace: %d  power: %d  cntrl: %d  flair: %d  vision: %d  accry: %d  stam: %d  disc: %d  fit: %d\n",
  357.                         p, PlyrIndex1,        
  358.                         EUROmatch_info.TeamA[p].pace,
  359.                         EUROmatch_info.TeamA[p].power,      
  360.                         EUROmatch_info.TeamA[p].control,      
  361.                         EUROmatch_info.TeamA[p].flair,      
  362.                         EUROmatch_info.TeamA[p].vision,      
  363.                         EUROmatch_info.TeamA[p].accuracy,  
  364.                         EUROmatch_info.TeamA[p].stamina,   
  365.                         EUROmatch_info.TeamA[p].discipline,
  366.                         EUROmatch_info.TeamA[p].fitness);
  367.                 }
  368.             
  369.                 EUROmatch_info.TeamB[p].pace        =    Pace[ PlyrIndex2 ];
  370.                 EUROmatch_info.TeamB[p].power        =    Power[ PlyrIndex2 ];
  371.                 EUROmatch_info.TeamB[p].control        =    Control[ PlyrIndex2 ];
  372.                 EUROmatch_info.TeamB[p].flair        =    Flair[ PlyrIndex2 ];
  373.                 EUROmatch_info.TeamB[p].vision        =    Vision[ PlyrIndex2 ];
  374.                 EUROmatch_info.TeamB[p].accuracy    =    Accuracy[ PlyrIndex2 ];
  375.                 EUROmatch_info.TeamB[p].stamina      =    Stamina[ PlyrIndex2 ];
  376.                 EUROmatch_info.TeamB[p].discipline     =    Discipline[ PlyrIndex2 ];
  377.                 EUROmatch_info.TeamB[p].fitness     =    Fitness[ PlyrIndex2 ];
  378.  
  379.             }
  380.  
  381.  
  382.         //…ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª 
  383.         //∫                                                       ∫
  384.         //∫ VERBOSE INFORMATION, DISPLAYS MATCH DATA IF REQUESTED ∫
  385.         //∫                                                       ∫
  386.         //»ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº 
  387.  
  388.                 if (EUROverbose)
  389.             {
  390.                 printf("    Number Of Users Playing Next Match:  %d\n",CntrlCnt);
  391.                 for (char u=0; u<CntrlCnt; u++)
  392.                 {printf("    User %d    %s\n", 
  393.                     u, GetTEXT( CNTL_LBLS+EUROmatch_info.CntrlTypes[u]) );}
  394.  
  395.                  
  396.  
  397.             }
  398.  
  399.  
  400. //        EUROmatch_info.EscKey = CntrlCnt;
  401.  
  402.         //…ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª 
  403.         //∫               ∫
  404.         //∫ EXECUTE MATCH ∫
  405.         //∫               ∫
  406.         //»ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº 
  407.  
  408.                init_team();
  409.  
  410. //            setup.team_a            =    0;
  411. //            setup.team_b            =    1;
  412.  
  413.             EUROmatch_info.referee_vision        =    EUROref_vision;
  414.             EUROmatch_info.referee_discipline    =    EUROref_discipline;
  415.             match_info.bookings        =    EURObookings;
  416.  
  417.             strcpy( &EUROmatch_info.RefsName[0], "TOM JONES" );
  418.  
  419.                 if (EUROverbose)
  420.             {
  421.                 printf("\n  MATCH AND ENVIRONMENT SETTINGS.\n\n");
  422.                     printf("    Bookings:        %s\n", GetTEXT( SETG_TEXT+(EUROmatch_info.bookings & 1) ) );
  423.                     printf("    Freekicks:        %s\n", GetTEXT( SETG_TEXT+(EUROmatch_info.freekicks & 1) ) );
  424.             }
  425.  
  426.  
  427.         
  428.  
  429.  
  430.  
  431.              EUROerror|=    match(argc,argv);
  432.  
  433.             Results[MatchNumber].HomeScore  = EUROmatch_info.Team_A_goals;
  434.             Results[MatchNumber].AwayScore  = EUROmatch_info.Team_B_goals;
  435.  
  436.  
  437.             if ( MatchNumber > 23 )
  438.             {        
  439.                 Results[MatchNumber].AfterExtra = EUROmatch_info.extra;
  440.                 Results[MatchNumber].AfterPens  = EUROmatch_info.penalties;
  441.                 Results[MatchNumber].HomePens   = EUROmatch_info.Team_A_penalties;
  442.                 Results[MatchNumber].AwayPens   = EUROmatch_info.Team_B_penalties;
  443.                 Results[MatchNumber].WinningTeam = EUROteamA;
  444.                 Results[MatchNumber].Message     = ProceedToNextRnd;
  445.  
  446.                 if ( EUROmatch_info.extra == 0 && EUROmatch_info.penalties == 0 )
  447.                 {
  448.                     Results[MatchNumber].Message     = ProceedToNextRnd;
  449.  
  450.                     if ( EUROmatch_info.Team_A_goals > EUROmatch_info.Team_B_goals )
  451.                         Results[MatchNumber].WinningTeam = EUROteamA;
  452.                     else                        
  453.                         Results[MatchNumber].WinningTeam = EUROteamB;
  454.                 }
  455.  
  456.                 else
  457.  
  458.                 if ( EUROmatch_info.extra != 0 && EUROmatch_info.penalties == 0 )
  459.                 {
  460.                     Results[MatchNumber].Message     = ExtraTime;
  461.  
  462.                     if ( EUROmatch_info.Team_A_goals > EUROmatch_info.Team_B_goals )
  463.                         Results[MatchNumber].WinningTeam = EUROteamA;
  464.                     else                        
  465.                         Results[MatchNumber].WinningTeam = EUROteamB;
  466.                 }
  467.  
  468.                 else
  469.  
  470.                 if ( EUROmatch_info.extra != 0 && EUROmatch_info.penalties == 0 )
  471.                 {
  472.                     Results[MatchNumber].Message     = Penalties;
  473.  
  474.                     if ( EUROmatch_info.Team_A_penalties > EUROmatch_info.Team_B_penalties )
  475.                         Results[MatchNumber].WinningTeam = EUROteamA;
  476.                     else                        
  477.                         Results[MatchNumber].WinningTeam = EUROteamB;
  478.                 }
  479.             
  480.             }
  481.             
  482.  
  483.  
  484.  
  485. //            ProcessResultData(MatchNumber);    
  486.                          
  487.             for (p=0; p<20; p++)
  488.             {        
  489.                 PlyrIndex1 = NormalisePlayer( p, EUROteamA );
  490.                 PlyrIndex2 = NormalisePlayer( p, EUROteamB );
  491.  
  492. //                printf("home index %d    =    %d\n", p, PlyrIndex1);
  493.                 
  494.                 if ( performance[p].inj > Fitness[PlyrIndex1] )
  495.                     Fitness[PlyrIndex1] = 1;
  496.                 else
  497.                     Fitness[PlyrIndex1]-=    performance[p].inj;                
  498.  
  499.                 DiscPts[PlyrIndex1]+=    performance[p].dpts;                
  500.  
  501.                 if ( performance[p+20].inj > Fitness[PlyrIndex2] )
  502.                     Fitness[PlyrIndex2] = 1;
  503.                 else
  504.                     Fitness[PlyrIndex2]-=    performance[p+20].inj;                
  505.  
  506.                 DiscPts[PlyrIndex2]+=    performance[p+20].dpts;                
  507.  
  508.                 if ( Fitness[PlyrIndex1] < 10 ) 
  509.                     Fitness[PlyrIndex1] = 10;
  510.                 if ( Fitness[PlyrIndex2] < 10 ) 
  511.                     Fitness[PlyrIndex2] = 10;
  512.  
  513. //                printf("     A dpts %d\n", performance[p].dpts );
  514. //                printf("     B dpts %d\n", performance[p+20].dpts );
  515.             }
  516.  
  517.             printf    ("\n\n");
  518.             
  519.             DoInjuriesAndMatchBans( EUROgameType, EUROteamA );
  520.             DoInjuriesAndMatchBans( EUROgameType, EUROteamB );
  521.  
  522.         //…ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª 
  523.         //∫                                                                   ∫
  524.         //∫ RESET FRONTEND VARIABLES WHICH MAY HAVE BEEN ALTERED DURING MATCH ∫
  525.         //∫                                                                   ∫
  526.         //»ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº 
  527.  
  528.             EUROcamera            =    EUROmatch_info.camera;
  529.             EUROvidi            =    EUROmatch_info.vidi;
  530.             EUROscrSize            =    setup.screen_size;
  531.             EUROsky                =      setup.detail.sky;
  532.             EUROlineDetail            =    setup.detail.lines;
  533.             EUROvidiType            =    setup.vidi_type;
  534.             EUROplyrDetail            =    setup.detail.players;
  535.             EUROptchDetail            =    setup.detail.pitch;
  536.             EUROresoln            =    setup.start_res;
  537.             EUROscrSize            =    setup.screen_size;
  538.  
  539.                 if (EUROverbose)
  540.                 printf("\n  ALLOCATING MEMORY AFTER RUNNING MATCH AND RETURNING TO FRONTEND.\n\n");
  541.  
  542.             AllocateDisplayBuffers();                     // Allocates two 640x480 display buffers.
  543.  
  544.             TexturePageMemHandle =                    // Set up memory handle.
  545.                 AllocateTexturePageMemory( 8,             // Specify number of texture pages to allocate.
  546.                 &FrontendTextureDEFN );                // Allocate memory for frontend texture pages.
  547.             LoadTexturePage( BIN_PAGE1,                        // Load texture page 1 into texture memory.
  548.                  &EuroDATfile[0],
  549.                  0, &FrontendTextureDEFN );
  550.             Set_640x480_VideoMode();
  551.  
  552.             RunMatch     =     No;
  553.  
  554.  
  555.             if ( EUROgameType == EURO_championship )
  556.             {
  557.  
  558.                 //…ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª 
  559.                 //∫               ∫
  560.                 //∫  GROUP MATCH  ∫
  561.                 //∫               ∫
  562.                 //»ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº 
  563.  
  564.                 if ( MatchNumber < 24 )
  565.                 {
  566.                     LeagueTable[EUROteamA].goalsFor     = EUROmatch_info.Team_A_goals;
  567.                     LeagueTable[EUROteamA].goalsAgainst = EUROmatch_info.Team_B_goals;
  568.                     LeagueTable[EUROteamB].goalsFor     = EUROmatch_info.Team_B_goals;
  569.                     LeagueTable[EUROteamB].goalsAgainst = EUROmatch_info.Team_A_goals;
  570.  
  571.                     if ( EUROmatch_info.Team_A_goals > EUROmatch_info.Team_B_goals )
  572.                     {
  573.                         LeagueTable[EUROteamA].won++;
  574.                         LeagueTable[EUROteamB].lost++;
  575.                     }
  576.  
  577.                     else
  578.  
  579.                     if ( EUROmatch_info.Team_A_goals < EUROmatch_info.Team_B_goals )
  580.                     {
  581.                         LeagueTable[EUROteamA].lost++;
  582.                         LeagueTable[EUROteamB].won++;
  583.                     }
  584.  
  585.                     else
  586.  
  587.                     if ( EUROmatch_info.Team_A_goals == EUROmatch_info.Team_B_goals )
  588.                     {
  589.                         LeagueTable[EUROteamA].drew++;
  590.                         LeagueTable[EUROteamB].drew++;
  591.                     }
  592.  
  593.                 }
  594.  
  595.                 MatchNumber++;
  596.  
  597.  
  598.                 //-----------------------------------------------------------------------
  599.                 // Were to go after a match has been played....
  600.  
  601.                                 //======================================
  602.                     if ( MatchNumber<25 )    // N.B. this is 29 so final tables
  603.                                 //      are displayed before qualifiers.
  604.                                     //======================================
  605.                           ChangeMenu    =    GROUP_FIXTURES;
  606.                 else
  607.                     if ( MatchNumber<29 )
  608.                            ChangeMenu    =    QUARTER_FINALS;
  609.                 else
  610.                     if ( MatchNumber<31 )
  611.                            ChangeMenu    =    SEMI_FINALS;
  612.  
  613.                 else
  614.                             ChangeMenu    =    MAIN;
  615.  
  616.                 //-----------------------------------------------------------------------
  617.  
  618.  
  619.             }
  620.  
  621.             else
  622.  
  623.             if ( EUROgameType == EURO_wireplay )
  624.                    ChangeMenu = EXIT_FRONTEND;
  625.             else                
  626.                   ChangeMenu = MAIN;
  627.     }
  628.  
  629. //********************************************************************************************************************************
  630.  
  631. void DisplayExtMatchTeams()
  632.     {
  633.          DisplayString( 
  634.              132-(PixelLengthOfString(GetTEAMname( EUROteamA, 11 ), LARGE_FONT)/2),
  635.              414,
  636.              GetTEAMname( EUROteamA, 11 ),
  637.              LARGE_FONT, 
  638.              43,
  639.              EURO_TEAMa_BOX,
  640.              &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  641.  
  642.          DisplayString( 
  643.              340-(PixelLengthOfString(GetTEAMname( EUROteamB, 11 ), LARGE_FONT)/2),
  644.              414,
  645.              GetTEAMname( EUROteamB, 11 ),
  646.              LARGE_FONT, 
  647.              50,
  648.              EURO_TEAMb_BOX,
  649.              &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  650.  
  651.         memcpy( &PaletteBuffer[44*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamA]*3)+3 ], 7*3 );
  652.         memcpy( &PaletteBuffer[51*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamB]*3)+3 ], 7*3 );
  653.  
  654.     }
  655.  
  656.  
  657. //********************************************************************************************************************************
  658.  
  659. void    DisplayNextMatchUsers( char gametype )
  660.     {
  661.         if ( gametype == EURO_championship )
  662.         {
  663.             char UserText[128];
  664.  
  665.             strcpy(UserText, GetTEXT ( MUSR_LBLS+ComputerUser) );
  666.             char Uflag = 0;
  667.  
  668.             for (char u=0; u<EUROnoOfMatchPlyrs; u++)
  669.             {        
  670.                 if ( UserList[u].team == EUROteamA )
  671.                 {
  672.                     if ( Uflag == 0 )
  673.                         strcpy(UserText, GetTEXT ( MUSR_LBLS+u) );
  674.                     else
  675.  
  676.                     {
  677.                         strcat(UserText, " & ");
  678.                         strcat(UserText, GetTEXT ( MUSR_LBLS+u) );
  679.                     }
  680.  
  681.                     Uflag++;
  682.                 }
  683.                }
  684.  
  685.             DisplayString( 125-(PixelLengthOfString( UserText, SMALL_FONT) /2 ), 460, 
  686.                UserText,
  687.                SMALL_FONT, 36, NO_BOX, 
  688.                &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  689.  
  690.             strcpy(UserText, GetTEXT ( MUSR_LBLS+ComputerUser) );
  691.             Uflag = 0;
  692.  
  693.             for (u=0; u<EUROnoOfMatchPlyrs; u++)
  694.             {        
  695.                 if ( UserList[u].team == EUROteamB )
  696.                 {
  697.                     if ( Uflag == 0 )
  698.                         strcpy(UserText, GetTEXT ( MUSR_LBLS+u) );
  699.                     else
  700.  
  701.                     {
  702.                         strcat(UserText, " & ");
  703.                         strcat(UserText, GetTEXT ( MUSR_LBLS+u) );
  704.                     }
  705.  
  706.                     Uflag++;
  707.                 }
  708.                }
  709.  
  710.             DisplayString( 347-(PixelLengthOfString( UserText, SMALL_FONT) /2 ), 460, 
  711.                UserText,
  712.                SMALL_FONT, 36, NO_BOX, 
  713.                &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  714.         }
  715.  
  716.     }
  717.  
  718. //********************************************************************************************************************************
  719.  
  720. void    DisplayNextMatchType( char gametype )
  721.     {
  722.         if ( EUROgameType == EURO_championship )
  723.         {
  724.             char VenueText[32];
  725.  
  726.             if ( MatchNumber < 24 )
  727.  
  728.                 DisplayString( 12, 98,
  729.                     GetTEXT ( GRUP_LBLS+( ( Fixtures[MatchNumber].HomeTeam & 12 )>>2 )),
  730.                     LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  731.             else                     
  732.                     
  733.             if ( MatchNumber < 28 )
  734.  
  735.                 DisplayString( 12, 98,
  736.                     GetTEXT ( MTCH_TYPE+QuarterFinal ),
  737.                     LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  738.             else                     
  739.                     
  740.             if ( MatchNumber < 30 )
  741.  
  742.                 DisplayString( 12, 98,
  743.                     GetTEXT ( MTCH_TYPE+SemiFinal ),
  744.                     LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  745.             else                     
  746.                     
  747.                 DisplayString( 12, 98,
  748.                     GetTEXT ( MTCH_TYPE+Final ),
  749.                     LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  750.                     
  751.  
  752.             strcpy(VenueText, ToUPPER(GetTEXT( VNUE_NMES+MatchVenues[MatchNumber] )) );
  753.  
  754.         // venue of match
  755.  
  756.             DisplayString( 
  757.                 430-(PixelLengthOfString( VenueText, MEDIUM_FONT )),
  758.                 98, VenueText, MEDIUM_FONT, 36, NO_BOX, 
  759.                 &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  760.  
  761.         // date of match
  762.  
  763.             DisplayString( 
  764.                 430-(PixelLengthOfString( GetTEXT( DATE_LBLS+MatchNumber ), SMALL_FONT)),
  765.                 120, GetTEXT( DATE_LBLS+MatchNumber ), SMALL_FONT, 36, NO_BOX, 
  766.                 &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  767.         }
  768.     }
  769.  
  770.  
  771. //********************************************************************************************************************************
  772.  
  773. void    NextMatchSelectButtons( char GAMEtype )
  774.     {
  775.         if ( GAMEtype == EURO_championship )
  776.         {
  777.             StartMatchHandle     =  AddAnimation( 446, 300, 
  778.                          ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  779.                          0.0, START_MATCH_BOX, CONT_ANIM );
  780.             StartMatchHighlight     =  ControlOptionHighlight( -1, START_MATCH_BOX,
  781.                            START_MATCHdisp_BOX, -1, 
  782.                            StartMatchHandle, BUTN_LBLS+StartMatch );
  783.  
  784.             TeamSetupHandle     =  AddAnimation( 446, 228, 
  785.                          ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  786.                          0.0, FORMATION_SETUP_BOX, CONT_ANIM );
  787.             TeamSetupHighlight     =  ControlOptionHighlight( -1, FORMATION_SETUP_BOX,
  788.                            FORMATION_SETUPdisp_BOX, -1, 
  789.                            TeamSetupHandle, BUTN_LBLS+TeamSetup );
  790.  
  791.             if ( ( EUROmatchUsers = FindNumberOfMatchUsers() ) > 0 )
  792.             {
  793.  
  794.                 PlayerSetupHandle     =  AddAnimation( 446, 180, 
  795.                                ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  796.                                0.0, PLAYER_SETUP_BOX, CONT_ANIM );
  797.                 PlyrSetupHighlight     =  ControlOptionHighlight( -1, PLAYER_SETUP_BOX,
  798.                                PLAYER_SETUPdisp_BOX, -1, 
  799.                                PlayerSetupHandle, BUTN_LBLS+PlayerSetup );
  800.             }
  801.         }
  802.     }
  803.  
  804.  
  805. //********************************************************************************************************************************
  806.  
  807.  
  808. void    DoNextMatchSelection( char MENU, signed char BOX )
  809.     {
  810.         if ( MENU == NEXT_MATCH && LogicState == RUN_FRONTEND )
  811.         {
  812.             if ( EUROgameType == EURO_championship )
  813.             {        
  814.  
  815.  
  816. //-------- console routine -------------------------------------------------------------------------------------------------------
  817.  
  818.                 if ( EUROconsole != 0 && keys[1]==1 && KeyToggle[1]==0 )
  819.                  {
  820.                     EUROmatch_info.EscKey^=    1;
  821.                     char    console[50];
  822.                     strcpy( &console[0], "Match Esc Key: ");
  823.                         strcat(console, GetTEXT( SETG_TEXT+(EUROmatch_info.EscKey & 1)) );
  824.                     
  825.                     CopyFromBACKtoPSEUDObuffer(
  826.                         &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  827.                         0, 0, 128, 24 );
  828.  
  829.                         DisplayString( 0, 0,
  830.                         console, SMALL_FONT, 36, 
  831.                         NO_BOX,    &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  832.  
  833.                         AddToDumpList( 0, 0, 128, 24 );
  834.                 }
  835.  
  836.                     KeyToggle[1] = keys[1];
  837.  
  838. //--------------------------------------------------------------------------------------------------------------------------------                
  839.  
  840.                 if ( BOX == START_MATCH_BOX && ButtonState != 0 )
  841.                   {
  842.                     Animation_table[StartMatchHandle].AnimationSpeed = 
  843.                         WhichButton( ButtonState, 0.85);
  844.                     RunMatch     =    Yes;
  845.                     ChangeMenu    =    MAIN;
  846.                          DeBounce      =     TRUE;
  847.                   }                                     
  848.     
  849.                 if ( BOX == FORMATION_SETUP_BOX && ButtonState != 0 )
  850.                   {
  851.                     Team =    ConfigureTeamView();
  852.                     Animation_table[TeamSetupHandle].AnimationSpeed = 
  853.                             WhichButton( ButtonState, 0.85);
  854.                            ChangeMenu    =    SQUAD_SELECT;
  855.                          DeBounce      =     TRUE;
  856.                   }                                     
  857.  
  858.  
  859.             if ( EUROmatchUsers>0 && EUROgameType == EURO_championship )
  860.             {
  861.                 PlyrSetupHighlight     =  ControlOptionHighlight( BOX, PLAYER_SETUP_BOX,
  862.                                PLAYER_SETUPdisp_BOX, PlyrSetupHighlight,
  863.                                PlayerSetupHandle, BUTN_LBLS+PlayerSetup );
  864.  
  865.                 if ( BOX == PLAYER_SETUP_BOX && ButtonState != 0 )
  866.                   {
  867.                     signed char u    =    EUROnoOfMatchPlyrs;
  868.                     EUROplyrSetup   =     0;
  869.  
  870.                     while    ( u>-1 )
  871.                     {                                
  872.                         if ( UserList[u].team == EUROteamA || UserList[u].team == EUROteamB )
  873.                             EUROplyrSetup = u;
  874.                         u--;
  875.                     }
  876.  
  877.                     Animation_table[PlayerSetupHandle].AnimationSpeed = 
  878.                             WhichButton( ButtonState, 0.85);
  879.                     ChangeMenu    =    PLAYER_SETUP;
  880.                          DeBounce      =     TRUE;
  881.                   }                                     
  882.             }
  883.  
  884.             StartMatchHighlight     =  ControlOptionHighlight( BOX, START_MATCH_BOX,
  885.                            START_MATCHdisp_BOX, StartMatchHighlight, 
  886.                            StartMatchHandle, BUTN_LBLS+StartMatch );
  887.  
  888.             TeamSetupHighlight     =  ControlOptionHighlight( BOX, FORMATION_SETUP_BOX,
  889.                            FORMATION_SETUPdisp_BOX, TeamSetupHighlight, 
  890.                            TeamSetupHandle, BUTN_LBLS+TeamSetup );
  891.             }
  892.  
  893.         }
  894.  
  895.     }
  896.  
  897.